package com.xjust.controller.physician;

import com.xjust.pojo.CheckRequest;
import com.xjust.pojo.Result;
import com.xjust.service.InspectionRequestService;
import com.xjust.service.MedicalTechnologyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;


@RestController
@RequestMapping("/medicalTechnologys")
public class MedicalTechnologyController {
    @Autowired
    MedicalTechnologyService medicalTechnologyService;
    @Autowired
    InspectionRequestService inspectionRequestService;
    //获取患者检查信息
    @GetMapping("/getMedicalTechnology")
    public Result getMedicalTechnology(Integer registId,String checkState){
        List<Map<String, Object>> list = medicalTechnologyService.getMedicalTechnology(registId,checkState);
        return Result.success(list);
    }
    //提交申请
    @PostMapping("/saveMedicalTechnology")
    public Result saveMedicalTechnology(@RequestBody List<Map<String,Object>> checkRequest){
        System.out.println(checkRequest);
        medicalTechnologyService.saveMedicalTechnology(checkRequest);
        return Result.success();
    }
    //提取检查、检验、处置项目
    @GetMapping("/selectMedicalTechnology")
    public Result selectMedicalTechnology(String tech_code,String tech_name,String tech_type){
        List<Map<String,Object>> list = medicalTechnologyService.selectMedicalTechnology(tech_code,tech_name,tech_type);
        return Result.success(list);
    }
    //获取患者检验信息
    @GetMapping("/getMedicalTechnologyByinspection")
    public Result getMedicalTechnologyByinspection(Integer registId,String inspectionState){
        List<Map<String, Object>> list = medicalTechnologyService.getMedicalTechnologyByinspection(registId,inspectionState);
        return Result.success(list);
    }
    //获取患者处置信息
    @GetMapping("/getMedicalTechnologyByDisposalRequest")
    public Result getMedicalTechnologyByDisposalRequest(Integer registId,String disposalState){
        List<Map<String, Object>> list = medicalTechnologyService.getMedicalTechnologyByDisposal(registId,disposalState);
        return Result.success(list);
    }
    //根据register_id获取患者所有检查项目'
    @GetMapping("/getAllMedicalTechnologyByRegisterId")
    public Result getAllMedicalTechnologyByRegisterId(Integer registerId,String state){
        List<Map<String,Object>> list = medicalTechnologyService.getAllMedicalTechnologyByRegisterId(registerId,state);

        return Result.success(list);
    }

    //检查管理获取对应id的挂号人员相关数据
    @GetMapping("/getMedicalTechnologyInfo")
    public List<Map<String,Object>> getMedicalTechnologyInfo(Integer registerId,String techType){
         return medicalTechnologyService.getAllMedicalTechnologyByRegisterId(registerId,techType);

    }
    @GetMapping("/selectMedicalTechnologyByRegisterId")
    public Result selectMedicalTechnologyByRegisterId(Integer registerId){
        List<Map<String,Object>> list = medicalTechnologyService.selectMedicalTechnologyByRegisterId(registerId);
        return Result.success(list);
    }

}
